import request from '@/utils/request'

// 获取 “dbtype” 定义
export function dbTypes() {
  return request({
    url: `/moon/db/dbtypes.svc`,
    method: 'GET'
  })
}
// 获取“数据库连接”列表
export function dbLists() {
  return request({
    url: `/moon/db/list.svc`,
    method: 'GET'
  })
}

// 获取一个“数据库连接”
export function dbGetSingle(id) {
  return request({
    url: `/moon/db/${id}/get.svc`,
    method: 'GET'
  })
}

// 新增
export function insertDb(data) {
  return request({
    url: `/moon/db/insert.svc`,
    method: 'POST',
    headers: {
      'content-type': 'application/json; chartset=utf-8'
    },
    data
  })
}

// 更新
export function updateDb(data) {
  return request({
    url: `/moon/db/${data.Id}/update.svc`,
    method: 'PUT',
    headers: {
      'content-type': 'application/json; chartset=utf-8'
    },
    data
  })
}

// 删除
export function DbDelete(id) {
  return request({
    url: `/moon/db/${id}/delete.svc`,
    method: 'DELETE'
  })
}
